<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="cardList">
      <el-table :data="userData" style="width: 100%" border stripe>
        <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
        <el-table-column prop="name" label="权限名称"></el-table-column>
        <el-table-column prop="rule" label="路径"></el-table-column>
        <el-table-column prop="lv" label="权限等级">
          <slot slot-scope="scope">
            <el-tag
              effect="dark"
              size="medium"
              disable-transitions
              hit
              :type="lvColor[scope.row.lv].type"
            >{{lvColor[scope.row.lv].label}}</el-tag>
          </slot>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
export default {
  created() {
    this.getDataList();
  },
  data() {
    return {
      userData: [],
      lvColor: [
        { type: "", label: "零级" },
        { type: "success", label: "一级" },
        { type: "info", label: "二级" },
        { type: "danger", label: "三级" }
      ]
    };
  },
  methods: {
    getDataList() {
      this.userData = [
        {
          name: "订单管理",
          rule: "rules",
          lv: 1
        },
        {
          name: "订单管理",
          rule: "rules",
          lv: 2
        },
        {
          name: "订单管理",
          rule: "rules",
          lv: 3
        },
        {
          name: "订单管理",
          rule: "rules",
          lv: 1
        },
        {
          name: "权限管理",
          rule: "rules",
          lv: 1
        },
        {
          name: "权限管理",
          rule: "rules",
          lv: 1
        },
        {
          name: "权限管理",
          rule: "rules",
          lv: 2
        },
        {
          name: "权限管理",
          rule: "rules",
          lv: 2
        },
        {
          name: "角色管理",
          rule: "rules",
          lv: 3
        },
        {
          name: "角色管理",
          rule: "right",
          lv: 3
        },
        {
          name: "角色管理",
          rule: "right",
          lv: 1
        },
        {
          name: "角色管理",
          rule: "right",
          lv: 2
        },
        {
          name: "身份管理",
          rule: "right",
          lv: 3
        },
        {
          name: "身份管理",
          rule: "right",
          lv: 3
        },
        {
          name: "身份管理",
          rule: "left",
          lv: 2
        },
        {
          name: "身份管理",
          rule: "left",
          lv: 1
        }
      ];
    }
  }
};
</script>
<style  scoped>
.cardList {
  margin-top: 15px;
}
</style>